<!--#begin vrequestslist -->

<script type="text/javascript">
<!--


function getDateFilter(fieldname) {

	bab_dialog.selectdate(function(arr) {
		document.vacfreqs.elements[fieldname].value = arr['day']+'-'+arr['month']+'-'+arr['year'];
	});

}

function openPopup()
{
	bab_dialog.selectuser( 
		function(arr) {
		document.forms['vacfreqs'].user.value	= arr['name'];
		document.forms['vacfreqs'].userid.value	= arr['id_user'];
		}
	)
}


function removeUser()
{
	document.forms['vacfreqs'].user.value	= '';
	document.forms['vacfreqs'].userid.value	= '';
}


function babReset()
{
document.forms['vacfreqs'].userid.value ='';
document.forms['vacfreqs'].user.value ='';
document.forms['vacfreqs'].datee.value ='';
document.forms['vacfreqs'].dateb.value ='';
}

//-->
</script>

<form method="post" action="{ babPhpSelf }" name="listform">
<input type="hidden" name="tg" value="vacadmb" />
<input type="hidden" name="idx" value="lreq" />
<table width="99%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> 
<td class="BabLoginCadreBackground"> 
	<table width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
        <tr class="BabSiteAdminTitleFontBackground"> 
            <td><a href="{ orderbyname }">{ nametxt }</a></td>
            <td><a href="{ orderbybegin }">{ begindatetxt }</a></td>
            <td>{ enddatetxt }</td>
            <td>{ quantitytxt }</td>
            <td width="5%">{ statustxt }</td>
			<td align="center">{ t_edit }</td>
			<td align="center">{ t_delete }</td>
        </tr>
          <!--#in getnext -->
        <!--#if altbg --><tr class="BabSiteAdminFontBackground"><!--#else altbg --><tr class="BabForumBackground1"><!--#endif altbg -->
            <td><a href="javascript: Start('{ url }', 'VacationWindow', 'width=500,height=380,status=no,resizable=yes,top=200,left=200');">{ urlname }</a></td>
            <td>{ begindate }</td>
            <td>{ enddate }</td>
            <td>{ quantity }</td>
            <td>{ status }</td>
            <td align="center"><a href="{ editurl }"><img src="{ babSkinPath }images/Puces/edit.gif" alt="{ alttxt }" border="0" /></a></td>
			<td align="center"><a href="{ urldelete }"><img src="{ babSkinPath }images/Puces/PuceDelete.png" alt="{ t_delete }" border="0" /></a></td>
        </tr>
          <!--#endin getnext -->
		<tr class="BabSiteAdminTitleFontBackground">
			<td> 
				&nbsp; 
				<!--#if topurl --><a href="{ topurl }"><img src="{ babSkinPath }images/Puces/arrowPrev3aa.gif" alt="{ t_first_page }" /></a><!--#endif topurl -->
				<!--#if prevurl --><a href="{ prevurl }"><img src="{ babSkinPath }images/Puces/arrowPrev3a.gif" alt="{ t_previous_page }" /></a><!--#endif prevurl -->
			</td>

			<td colspan="5" align="center">
				{ t_position }
			</td>

			<td align="right"> 
				<!--#if nexturl --><a href="{ nexturl }"><img src="{ babSkinPath }images/Puces/arrowNext3a.gif" alt="{ t_next_page }" /></a><!--#endif nexturl -->
				<!--#if bottomurl --><a href="{ bottomurl }"><img src="{ babSkinPath }images/Puces/arrowNext3aa.gif" alt="{ t_last_page }" /></a><!--#endif bottomurl -->
				&nbsp; 
			</td>
		</tr>
	</table>
</td>
</tr>
</table>
</form>


<br>
<form name="vacfreqs" method="get" action="{ babPhpSelf }" >
<input type="hidden" name="tg" value="vacadmb" />
<input type="hidden" name="idx" value="lreq" />
<input type="hidden" name="vpos" value="{ pos }" />
<input type="hidden" name="orderby" value="{ orderby }" />
<table border="0" width="99%" cellpadding="2" cellspacing="0" align="center">
<tr>
<td class="BabLoginCadreBackground"> 
<table class="BabLoginMenuBackground" border="0" width="100%" cellpadding="2" cellspacing="0" align="center">
	<tr valign="middle"> 
		<td>&nbsp;</td>
		<td>{ statustxt }</td>
		<td><a href="#" onclick="openPopup();return false;">{ usertxt }</a></td>
		<td>{ datetxt }</td>
	</tr>
	<tr> 
		<td>
			<input type="submit" name="submit" value="{ filteron }" />
		</td>
		<td>
			<select name="idstatus">
			<option value=""></option>
			<!--#in getnextstatus -->
			<option value="{ statusid }" { selected }>{ statusname }</option>
			<!--#endin getnextstatus -->
			</select>
		</td>
		<td>
			<input type="text" name="user" size="35" maxlength="255" value="{ userval }" disabled="disabled" />
			<input type="hidden" name="userid" value="{ userid }" />
			<a href="" onclick="removeUser();return false;"><img src="{ babSkinPath }images/Puces/delete.png" border="0" /></a>
		</td>
		<td>
			<a href="#" onclick="getDateFilter('dateb');return false;">{ begintxt }</a> 
			<input type="text" name="dateb" size="10" maxlength="10" value="{ dateb }" />
			&nbsp;<a href="#" onclick="getDateFilter('datee');return false;">{ endtxt }</a> 
			<input type="text" name="datee" size="10" maxlength="10" value="{ datee }" />
		</td>
	</tr>
	<tr valign="middle"> 
		<td colspan="4">
			<input type="button" name="submit" value="{ resettxt }" onClick="babReset()" />
		</td>
	</tr>
</table>
</td>
</tr>
</table>
</form>
<!--#end vrequestslist -->


<!--#begin editvacrequest -->
<script type="text/javaScript">
<!--

function validateNum(field) {
var valid = ".0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
var d1;
alert("{ invalidentry }");
field.focus();
field.select();
return false;
   }
return true;
}

function validateDayField(field) {
	if( field.value.length > 0 && validateNum(field))
	{
	tp = parseFloat(field.value);
	if( isNaN(tp) )
		alert( '{ invalidentry1 }');
	if( tp % 0.5 != 0 )
		{
		alert( '{ invalidentry2 }' );
		field.focus();
		field.select();
		}
	var total = 0;
	for( i=0; i < document.vacform.elements.length; i++)
	{
		if( document.vacform.elements[i].name.substring(0, 6) == 'nbdays')
		{
			total += parseFloat(document.vacform.elements[i].value);
		}
	}
	document.vacform.elements['total'].value = total;
	}
}
function updateDates(elemDay, elemMonth, elemYear)
{
	ds = elemDay.selectedIndex;
	timeA = new Date(elemYear.options[elemYear.selectedIndex].text, elemMonth.options[elemMonth.selectedIndex].value,1);
	timeDifference = timeA - 86400000;
	timeB = new Date(timeDifference);
	var daysInMonth = timeB.getDate();
	for (var i = 0; i < elemDay.length; i++)
	{
	elemDay.options[0] = null;
	}
	for (var i = 0; i < daysInMonth; i++)
	{
	elemDay.options[i] = new Option(i+1);
	}
	if( ds < daysInMonth )
	elemDay.options[ds].selected = true;
	else
	elemDay.options[daysInMonth-1].selected = true;
}

function dateBegin(param)
{
	day 	= param.day;
	month 	= param.month;
	year 	= param.year;

	document.vacform.elements['daybegin'].options[day-1].selected = true;
	document.vacform.elements['monthbegin'].options[month-1].selected = true;
	document.vacform.elements['yearbegin'].options[year-{ startyear }].selected = true;
	updateDates(document.vacform.elements['daybegin'], document.vacform.elements['monthbegin'], document.vacform.elements['yearbegin']);
}

function dateEnd(param)
{
	day 	= param.day;
	month 	= param.month;
	year 	= param.year;

	document.vacform.elements['dayend'].options[day-1].selected = true;
	document.vacform.elements['monthend'].options[month-1].selected = true;
	document.vacform.elements['yearend'].options[year-{ startyear }].selected = true;
	updateDates(document.vacform.elements['dayend'], document.vacform.elements['monthend'], document.vacform.elements['yearend']);

}

function validateForm(fr)
{
var ret = true;
if( fr.yearbegin.selectedIndex > fr.yearend.selectedIndex )
	{
	ret = false;
	}
else if( fr.yearbegin.selectedIndex == fr.yearend.selectedIndex )
	{
		if( fr.monthbegin.selectedIndex > fr.monthend.selectedIndex )
		{
		ret = false;
		}
		else if( fr.monthbegin.selectedIndex == fr.monthend.selectedIndex ) 
		{
		if( fr.daybegin.selectedIndex > fr.dayend.selectedIndex )
			{
			ret = false;
			}
		}
	}

if( ret == false)
	{
	var d1;
	alert ('{ invaliddate }');
	return false;
	}

dateA = new Date(fr.yearbegin.options[fr.yearbegin.selectedIndex].text, fr.monthbegin.options[fr.monthbegin.selectedIndex].value-1, fr.daybegin.options[fr.daybegin.selectedIndex].text );
dateB = new Date(fr.yearend.options[fr.yearend.selectedIndex].text, fr.monthend.options[fr.monthend.selectedIndex].value-1, fr.dayend.options[fr.dayend.selectedIndex].text );

diff = ((dateB - dateA)/86400000)+1;

if( parseFloat(fr.total.value) > diff )
	{
	var d2;
	alert ( '{ invaliddate2 }');
	return false;
	}
return true;
}
//-->
</script>
<form name="vacform" method="post" action="{ babPhpSelf }" onSubmit="return validateForm(this);">
<input type="hidden" name="tg" value="vacadmb">
<input type="hidden" name="idx" value="lreq">
<input type="hidden" name="add" value="modvr">
<input type="hidden" name="vrid" value="{ vrid }">
<input type="hidden" name="styear" value="{ startyear }">
<table class="BabLoginCadreBackground" width="70%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> 
<td> 
<table class="BabLoginMenuBackground" width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
<tr> 
<td align="right"><a href="" onclick="bab_dialog.selectdate(dateBegin);return false;">{ datebegintxt }</a>: </td>
<td valign="middle"> 
<select name="daybegin">
  <!--#in getnextday -->
  <option value="{ dayid }" { selected }>{ dayid }</option>
  <!--#endin getnextday -->
</select>
</td>
<td valign="middle"> 
<select name="monthbegin" onChange="updateDates(this.form.daybegin, this.form.monthbegin, this.form.yearbegin);">
  <!--#in getnextmonth -->
  <option value="{ monthid }" { selected }>{ monthname }</option>
  <!--#endin getnextmonth -->
</select>
</td>
<td valign="middle"> 
<select name="yearbegin" onChange="updateDates(this.form.daybegin, this.form.monthbegin, this.form.yearbegin);">
  <!--#in getnextyear -->
  <option value="{ yearidval }"  { selected }>{ yearidval }</option>
  <!--#endin getnextyear -->
</select>
</td>
<td valign="middle"> 
<select name="halfdaybegin">
  <!--#in getnexthalf -->
  <option value="{ halfid }" { selected }>{ halfname }</option>
  <!--#endin getnexthalf -->
</select>
</td>
</tr>
<tr> 
<td width="45%" align="right" valign="middle"><a href="" onclick="bab_dialog.selectdate(dateEnd);return false;">{ dateendtxt }</a>: </td>
<td valign="middle"> 
<select name="dayend">
  <!--#in getnextday -->
  <option value="{ dayid }"  { selected }>{ dayid }</option>
  <!--#endin getnextday -->
</select >
</td>
<td valign="middle"> 
<select name="monthend" onChange="updateDates(this.form.dayend, this.form.monthend, this.form.yearend);">
  <!--#in getnextmonth -->
  <option value="{ monthid }"  { selected }>{ monthname }</option>
  <!--#endin getnextmonth -->
</select >
</td>
<td valign="middle"> 
<select name="yearend" onChange="updateDates(this.form.dayend, this.form.monthend, this.form.yearend);">
  <!--#in getnextyear -->
  <option value="{ yearidval }" { selected }>{ yearidval }</option>
  <!--#endin getnextyear -->
</select >
</td>
<td valign="middle"> 
<select name="halfdayend">
  <!--#in getnexthalf -->
  <option value="{ halfid }" { selected }>{ halfname }</option>
  <!--#endin getnexthalf -->
</select >
</td>
</tr>
<tr> 
<td align="right">{ nbdaystxt }: </td>
<td colspan="4">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr><td>&nbsp;</td><td>&nbsp;</td><td>{ balancetxt }</td></tr>
<!--#in getnexttype -->
<tr><td><input type="text" name="{ nbdaysname }" size="5" maxlength="5" value="{ nbdays }" onBlur="validateDayField(this)" /></td><td>{ typename }</td><td>{ quantitydays }</td></tr>
<!--#endin getnexttype -->
</table>
</td>
</tr>
<tr> 
<td align="right">{ totaltxt }: </td>
<td colspan="4">
<input type="text" name="total" size="5" maxlength="5" value="{ totalval }" />
</td>
</tr>
<tr> 
<td align="right">{ remark }: </td>
<td colspan="4">
<textarea cols="40" rows="10" name="remarks">{ remarks }</textarea>
</td>
</tr>
<tr> 
<td>&nbsp;</td>
<td colspan="4" valign="middle"> 
<input type="submit" name="Submit" value="{ addvac }" />&nbsp;&nbsp;<input type="submit" name="bdelete" value="{ deletetxt }" />
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</form>
<!--#end editvacrequest -->




<!--#begin reqexport -->
<script type="text/javascript">
<!--

function dateBegin(day, month, year)
{
	document.forms['export'].dateb.value = day+'-'+month+'-'+year;
}

function dateEnd(day, month, year)
{
	document.forms['export'].datee.value = day+'-'+month+'-'+year;
}
//-->
</script>
<form method="post" name="export" action="{ babPhpSelf }">
<input type="hidden" name="tg" value="vacadmb" />
<input type="hidden" name="idx" value="lreq" />
<table width="70%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> 
<td class="BabLoginCadreBackground"> 
	<table class="BabLoginMenuBackground" width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
	<tr> 
		<td align="right" width="40%"><a href="javascript: Start('{ dateburl }', 'CalendarWindow', 'width=250,height=250,status=no,resizable=no,top=200,left=200');">{ datebegintxt }:</a></td>
		<td> 
		<input type="text" name="dateb" size="10" maxlength="10" value="" />
		&nbsp;&nbsp;{ dateformattxt } </td>
	</tr>
	<tr> 
		<td align="right"><a href="javascript: Start('{ dateeurl }', 'CalendarWindow', 'width=250,height=250,status=no,resizable=no,top=200,left=200');">{ dateendtxt }:</a></td>
		<td> 
		<input type="text" name="datee" size="10" maxlength="10" value="">
		&nbsp;&nbsp;{ dateformattxt } </td>
	</tr>
	<tr> 
		<td align="right" nowrap>{ statustxt }:</td>
		<td> 
		<!--#in getnextstatus -->
		<br><input type="checkbox" name="idstatus[]" checked value="{ statusid }">&nbsp;&nbsp;{ statusname }
		<!--#endin getnextstatus -->
		</td>
	</tr>
	<tr> 
		<td align="right">{ separatortxt }:</td>
		<td> 
		<select name="wsepar">
		<option value="0">{ other }</option>
		<option value="1" selected >{ comma }</option>
		<option value="2">{ tab }</option>
		</select>&nbsp;&nbsp;
		<input type="text" name="separ" size="1" maxlength="1" value="" />
		</td>
	</tr>
	<tr> 
		<td align="right">{ sepdectxt }:</td>
		<td> 
		<input type="text" name="sepdec" size="1" maxlength="1" value="," />
		</td>
	</tr>
	<tr> 
		<td align="center" colspan="2">{ t_users_without_requests }: 
		<select name="users_without_requests">
			<option value="0">{ t_no }</option>
			<option value="1">{ t_yes }</option>
		</select>
		</td>
	</tr>
	<tr> 
		<td>&nbsp;</td>
		<td> 
		<input type="submit" name="bexport" value="{ export }" />
		</td>
	</tr>
	</table>
</td>
</tr>
</table>
</form>
<!--#end reqexport -->

<!--#begin reqdelete -->
<script type="text/javascript">
<!--
var op = null;
function openPopup(url)
{
if( op == null || op.closed )
	op = this.open(url+'onUser', 'babuserslist', 'width=550,height=550,status=no,resizable=yes,top=200,left=200,scrollbars=yes');
else
	{
	op.focus();
	}
}
function onUser(id, fn)
{
document.forms.delreq.user.value=fn;
document.forms.delreq.userid.value=id;
this.focus();
op.close();
}

function dateBegin(day, month, year)
{
	document.delreq.elements['dateb'].value = day+'-'+month+'-'+year;
}
//-->
</script>
<!--#end prightsadd -->
<form name="delreq" method="post" action="{ babPhpSelf }">
<input type="hidden" name="tg" value="vacadmb" />
<input type="hidden" name="idx" value="ddreq" />
<table width="70%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> 
<td class="BabLoginCadreBackground"> 
	<table class="BabLoginMenuBackground" width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
	<tr> 
		<td align="right"><a href="javascript: Start('{ dateburl }', 'CalendarWindow', 'width=250,height=250,status=no,resizable=no,top=200,left=200');">{ 
		datetxt }:</a></td>
		<td> 
		<input type="text" name="dateb" size="10" maxlength="10" value="{ datebval }" />
		&nbsp;&nbsp;{ dateformattxt } </td>
	</tr>
	<tr> 
		<td align="right"><a href="javascript: openPopup('{ usersbrowurl }');">{ usertext }</a>:</td>
		<td> 
		<input type="text" name="user" size="45" maxlength="255" value="{ userval }" disabled>
		<input type="hidden" name="userid" value="{ userid }">
		</td>
	</tr>
	<tr> 
		<td>&nbsp;</td>
		<td> 
		<input type="submit" name="bdel" value="{ delete }" />
		</td>
	</tr>
	</table>
</td>
</tr>
</table>
</form>
<!--#end reqdelete -->
